<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Dish_type')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-dish_type" class="form-control selectpicker" name="row[dish_type]">
                {foreach name="dishTypeList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.dish_type"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images" class="form-control" size="50" name="row[images]" type="textarea" value="{$row.images|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-images"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-images"></ul>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">食材选择:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input type="text" id="c-selected-ingredients" class="form-control" placeholder="点击选择食材" readonly>
                <input type="hidden" id="c-ingredient-ids" name="row[ingredient_ids]" value="">
                <input type="hidden" id="c-ingredient-data" name="row[ingredient_data]" value='{$ingredientData}'>
                <div class="input-group-addon">
                    <button type="button" id="btn-select-ingredients" class="btn btn-info btn-sm">
                        <i class="fa fa-search"></i> 选择食材
                    </button>
                </div>
            </div>
            <div id="selected-ingredients-table" class="well well-sm" style="margin-top: 10px; display: none;">
                <h5 style="margin-top: 0; margin-bottom: 15px;">已选择的食材：</h5>
                <div class="table-responsive">
                    <table class="table table-bordered table-condensed" id="ingredients-table">
                        <thead>
                            <tr>
                                <th width="30%">食材名称</th>
                                <th width="20%">重量(g)</th>
                                <th width="20%">单位能量(千卡/100g)</th>
                                <th width="20%">总能量(千卡)</th>
                                <th width="10%">操作</th>
                            </tr>
                        </thead>
                        <tbody id="ingredients-tbody">
                        </tbody>
                        <tfoot>
                            <tr class="info">
                                <th>合计</th>
                                <th id="total-weight">0g</th>
                                <th>-</th>
                                <th id="total-energy">0千卡</th>
                                <th>-</th>
                            </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Steps')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-steps" class="form-control " rows="5" name="row[steps]" cols="50">{$row.steps|htmlentities}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-description" class="form-control" rows="3" name="row[description]" cols="50">{$row.description|htmlentities}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Cook_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-cook_time" class="form-control" name="row[cook_time]" type="text" value="{$row.cook_time|htmlentities}" placeholder="例如：30分钟">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Difficulty')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-difficulty" class="form-control selectpicker" name="row[difficulty]">
                {foreach name="difficultyList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.difficulty"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>
